home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 131 / XENIATGM131.iso / Goodies / I-WAR 2 Egde of Chaos - New SDK / IW2-EOC_Pog_Scripting_SDK.exe / include / Sim.h < prev    next >
C/C++ Source or Header  |  2002-01-14  |  12KB  |  485 lines

  1. //
  2. // (c) 1999 Particle Systems Ltd. All Rights Reserved
  3. //
  4. // Sim.h
  5. //
  6. // API for the package Sim.
  7. //
  8. // Revision control information:
  9. //
  10. // $Header: /flux/packages/Sim.h 43    3/04/01 16:19 Tim $
  11. //
  12.  
  13. #include "Flux.h"
  14.  
  15. #ifdef FLUX_COMPILE
  16.  
  17. FLUX_DECLARE_EXTENSION(Sim);
  18.  
  19. #ifdef FLUX_LIB
  20. #if _MSC_VER >= 1000
  21. #pragma comment( lib, "sim" )
  22. #endif // _MSC_VER >= 1000
  23. #endif // FLUX_LIB
  24.  
  25. #else
  26.  
  27. // Declare a hsim handle type.
  28. handle hsim : hobject;
  29.  
  30. // Dependencies
  31. uses Set, Group, Subsim;
  32.  
  33. // Handle operations ///////////////////////////////////////////////////////////
  34.  
  35. //
  36. // hsim Sim.Cast( hobject )
  37. //
  38. // Create a sim as a dynamic cast from the hobject
  39. //
  40. prototype hsim Sim.Cast( hobject object_handle );
  41.  
  42. // Sim creation and deletion ///////////////////////////////////////////////////
  43.  
  44. //
  45. // hsim Create( string class_name, string sim_name, string filename )
  46. //
  47. // Create a new sim from the given template, and set its name to be sim_name.
  48. //
  49. prototype hsim Sim.Create( string template_name, string sim_name );
  50.  
  51. //
  52. // bool IsDead( hsim sim )
  53. //
  54. // Returns true if the sim is dead (or has been culled)
  55. //
  56. prototype bool Sim.IsDead( hsim sim );
  57.  
  58. //
  59. // bool IsAlive( hsim sim )
  60. //
  61. // Returns true if the sim is alive
  62. //
  63. prototype bool Sim.IsAlive( hsim sim );
  64.  
  65. //
  66. // Preload( string template )
  67. //
  68. // Preload a sim with the given template.
  69. //
  70. prototype Sim.Preload( string template );
  71.  
  72. //
  73. // Destroy( hsim sim )
  74. //
  75. // Destroys a sim and removed it from the world.
  76. //
  77. prototype Sim.Destroy( hsim sim );
  78.  
  79. //
  80. // TemplateName( hsim sim )
  81. //
  82. // Returns the resource template originally used
  83. // to create the sim.
  84. //
  85. prototype string Sim.TemplateName( hsim sim );
  86.  
  87.  
  88. // Sim placement ///////////////////////////////////////////////////////////////
  89.  
  90. //
  91. // bool PlaceAt( hsim sim, hsim marker )
  92. //
  93. // Place the sim at the given sim. Return false if either handle is 
  94. // invalid. Again, the world will be set if it is not already.
  95. //
  96. prototype bool Sim.PlaceAt( hsim sim, hsim marker );
  97.  
  98. //
  99. // void PointAt( hsim sim, hsim marker )
  100. //
  101. // Point the sim at the given sim.
  102. // Again, the world will be set if it is not already.
  103. //
  104. prototype Sim.PointAt( hsim sim, hsim marker );
  105.  
  106. //
  107. // PointAway( hsim sim, hsim marker )
  108. //
  109. // Point the sim away from the given sim.
  110. // Again, the world will be set if it is not already.
  111. //
  112. prototype Sim.PointAway( hsim sim, hsim marker );
  113.  
  114. //
  115. // bool IsInFOV( hsim sim1, hsim sim2 )
  116. //
  117. // Returns true if sim2 is within sim1's field of view (fov - degrees)
  118. //
  119. prototype bool Sim.IsInFOV( hsim sim1, hsim sim2, float fov );
  120.  
  121. //
  122. // float Speed( hsim sim )
  123. //
  124. // Returns the speed of the given sim
  125. //
  126. prototype float Sim.Speed( hsim sim );
  127.  
  128. //
  129. // bool PlaceRelativeTo( hsim sim, hsim marker, float x, float y, float z )
  130. //
  131. // Place the sim relative to the given sim with sim aligned coordinate
  132. // axis. Return false if either handle is invalid.
  133. //
  134. // The world will be set if it is not already.
  135. //
  136. prototype bool Sim.PlaceRelativeTo( hsim sim, hsim marker, float x, float y, float z );
  137.  
  138. //
  139. // bool PlaceBetween( hsim sim, hsim begin, hsim end, float distance )
  140. //
  141. // Place the given sim between the two given sims at the given distance from
  142. // the start sim. The distance is between [0,1]
  143. //
  144. prototype bool Sim.PlaceBetween( hsim sim, hsim begin, hsim end, float distance );
  145.  
  146. //
  147. // bool PlaceNear( hsim sim, hsim marker, float distance )
  148. //
  149. // Place the given sim in the area around the given sim at the given distance.
  150. //
  151. prototype bool Sim.PlaceNear( hsim sim, hsim marker, float distance );
  152.  
  153. //
  154. // bool PlaceInFrontOf( hsim sim, hsim other_sim, float distance )
  155. //
  156. // Place the other_sim in front of the given sim by the given distance
  157. //
  158. prototype bool Sim.PlaceInFrontOf( hsim sim, hsim other_sim, float distance );
  159.  
  160. //
  161. // bool PlaceRelativeToInside( hsim sim, hsim other_sim, float x, float y, float z )
  162. //
  163. // Similiar to PlaceRelativeTo except it allows placemenet of objects inside objects.
  164. // Use with caution!!!
  165. //
  166. prototype bool Sim.PlaceRelativeToInside( hsim sim, hsim other_sim, float x, float y,
  167.                                           float z );
  168.  
  169. //
  170. // void SetOrientationEuler( hsim sim, float yaw, float pitch, float roll )
  171. //
  172. // 
  173. //
  174. prototype Sim.SetOrientationEuler( hsim sim, float yaw, float pitch, float roll );
  175.  
  176. //
  177. // void CopyOrientation( hsim dest, hsim src )
  178. //
  179. // Give the given sim the orientation of the other given sim
  180. //
  181. prototype Sim.CopyOrientation( hsim dest, hsim src );
  182.  
  183. //
  184. // void SetAngularVelocityEuler( hsim sim, float yaw_dps, float pitch_dps, float roll_dps)
  185. //
  186. // Give the sim a rotational velocity, with Euler angular rates in degrees per second.
  187. //
  188. prototype Sim.SetAngularVelocityEuler( hsim sim, float yaw_dps, float pitch_dps, float roll_dps );
  189.  
  190. //
  191. // void SetAngularVelocity( hsim sim, float x, float y, float z, float dps )
  192. //
  193. // Set a rate of rotation around a vector axis. The vector will be normalised by the function.
  194. //
  195. prototype Sim.SetAngularVelocity( hsim sim, float x, float y, float z, float dps );
  196.  
  197. //
  198. // void SetVelocity( hsim sim, float x, float y, float z )
  199. //
  200. // Give the sim an initial linear velocity in world coordinates.
  201. //
  202. prototype Sim.SetVelocity( hsim sim, float x, float y, float z );
  203.  
  204. //
  205. // void SetVelocityLocalToSim( hsim sim, float x, float y, float z )
  206. //
  207. // Give the sim an initial linear velocity in local coordinates
  208. //
  209. prototype Sim.SetVelocityLocalToSim( hsim sim, float x, float y, float z );
  210.  
  211. //
  212. // void SetRadius( float radius )
  213. //
  214. // Sets the radius of a sim
  215. //
  216. prototype Sim.SetRadius( float radius );
  217.  
  218. // Sim property accessors //////////////////////////////////////////////////////
  219.  
  220. //
  221. // bool IsInteresting( hsim sim )
  222. //
  223. // Returns TRUE if the given sim is flagged as interesting.
  224. //
  225. prototype bool Sim.IsInteresting( hsim sim );
  226.  
  227. //
  228. // IsCullable( hsim sim )
  229. //
  230. // Returns TRUE if the given sim will be culled if uninteresting.
  231. //
  232. prototype bool Sim.IsCullable( hsim sim );
  233.  
  234. //
  235. // IsHidden( hsim sim )
  236. //
  237. // Returns TRUE if the given sim is flagged as hidden.
  238. //
  239. prototype bool Sim.IsHidden( hsim sim );
  240.  
  241. //
  242. // SetHidden( hsim sim, bool hidden )
  243. //
  244. // Sets the hidden status of a sim.
  245. //
  246. prototype bool Sim.SetHidden( hsim sim, bool hidden );
  247.  
  248. //
  249. // SetCullable( hsim sim, bool cullable )
  250. //
  251. // Sets the cull-if-not-interesting flag of the sim
  252. //
  253. prototype Sim.SetCullable( hsim sim, bool cullable );
  254.  
  255. //
  256. // float DistanceBetween( hsim sim1, hsim sim2 )
  257. //
  258. // Find the distance between two sims.
  259. //
  260. prototype float Sim.DistanceBetween( hsim sim1, hsim sim2 );
  261.  
  262. //
  263. // float DistanceBetweenCentres( hsim sim1, hsim sim2 )
  264. //
  265. // Find the distance between the centres of two sims.
  266. //
  267. prototype float Sim.DistanceBetweenCentres( hsim sim1, hsim sim2 );
  268.  
  269. // Sim tree manipulation ///////////////////////////////////////////////////////
  270.  
  271. //
  272. // AttachChild( hsim parent, hsim child )
  273. //
  274. // Attach the sim child as a child of the sim parent, keeping their current
  275. // physical locations.
  276. //
  277. prototype Sim.AttachChild( hsim parent, hsim child );
  278.  
  279. //
  280. // DetachChild( hsim parent, hsim child )
  281. //
  282. // Detach the sim child from the sim parent.
  283. //
  284. prototype Sim.DetachChild( hsim parent, hsim child );
  285.  
  286. //
  287. // AddChildRelativeTo( hsim parent, hsim child, float x, float y, float z )
  288. //
  289. // Add the given child to the given parent at the given offset.
  290. //
  291. prototype Sim.AddChildRelativeTo( hsim parent, hsim child, float x, float y, float z );
  292.  
  293. // Sim Organisation Queries ////////////////////////////////////////////////////
  294.  
  295. //
  296. // hsim First()
  297. //
  298. // Get the first sim in the world.
  299. //
  300. prototype hsim Sim.First();
  301.  
  302. //
  303. // int ChildCount( hsim sim )
  304. //
  305. // Returns the number of children -- Note that this should be atomic if 
  306. // used in a loop with NthChild as (in theory) ChildCount could change
  307. // between script time slices.
  308. //
  309. prototype int Sim.ChildCount( hsim sim );
  310.  
  311. //
  312. // hsim NthChild( hisim sim, int child_num )
  313. //
  314. // Returns the nth child of the given sim (see above)
  315. //
  316. prototype hsim Sim.NthChild( hsim sim, int child_num );
  317.  
  318. //
  319. // hsim Parent()
  320. //
  321. // Get the parent of the given sim
  322. //
  323. prototype hsim Sim.Parent( hsim sim );
  324.  
  325. //
  326. // string Name()
  327. //
  328. // Gets the name of the sim
  329. //
  330. prototype string Sim.Name( hsim sim );
  331.  
  332. //
  333. // hsim FindByName( string name )
  334. //
  335. // Return the first sim found that matches the Name given.
  336. //
  337. prototype hsim Sim.FindByName( string name );
  338.  
  339. //
  340. // set FindByWildcard( string wildcard )
  341. //
  342. // Use a wildcard to retrieve a set of sims from the current world.
  343. //
  344. prototype set Sim.FindByWildcard( string wildcard );
  345.  
  346. //
  347. // set Children( hsim sim )
  348. //
  349. // Get a set of all the children of a given sim
  350. //
  351. prototype set Sim.Children( hsim sim );
  352.  
  353. // Sim event management ////////////////////////////////////////////////////////
  354.  
  355. //
  356. // bool GetEvent( hsim sim, string event_name )
  357. //
  358. // Test to see if an event flag is set. If it is then clear it.
  359. //
  360. prototype bool Sim.GetEvent( hsim sim, string event_name );
  361.  
  362. //
  363. // bool PeekEvent( hsim sim, string event_name )
  364. //
  365. // Test to see if an event flag is set. Do not unset it if it is.
  366. //
  367. prototype bool Sim.PeekEvent( hsim sim, string event_name );
  368.  
  369. //
  370. // bool SetEvent( hsim sim, string event_name )
  371. //
  372. // Set an event.
  373. //
  374. prototype bool Sim.SetEvent( hsim sim, string event_name );
  375.  
  376. //
  377. // bool ClearEvent( hsim sim, string event_name )
  378. //
  379. // Set or clear the event flag on a sim.
  380. //
  381. prototype bool Sim.ClearEvent( hsim sim, string event_name );
  382.  
  383. // Group accessors ///////////////////////////////////////////////////////////
  384.  
  385. //
  386. // hgroup Sim.Group( hsim sim )
  387. //
  388. // Returns our current group if we have one.
  389. //
  390. prototype hgroup Sim.Group( hsim sims );
  391.  
  392. // Subsim support ////////////////////////////////////////////////////////////
  393.  
  394. //
  395. // int Sim.SubsimCount( hsim sim )
  396. //
  397. // Returns the number of subsims carried by a sim.
  398. //
  399. prototype int Sim.SubsimCount( hsim sim );
  400.  
  401. //
  402. // hsubsim Sim.NthSubsim( hsim sim, int n )
  403. //
  404. // Returns the nth subsim carried by a sim
  405. //
  406. prototype hsubsim Sim.NthSubsim( hsim sim, int n );
  407.  
  408. //
  409. // hsubsim Sim.RemoveNthSubsim( hsim sim, int n )
  410. //
  411. // Removes the nth subsim carried by a sim.  All other subsims are shuffled
  412. // downwards.
  413. //
  414. prototype hsubsim Sim.RemoveNthSubsim( hsim sim, int n );
  415.  
  416. //
  417. // bool Sim.AddSubsim( hsim sim, hsubsim subsim )
  418. //
  419. // Adds a subsim to a sim.  Returns true if it succeeds.
  420. //
  421. prototype bool Sim.AddSubsim( hsim sim, hsubsim subsim );
  422.  
  423. //
  424. // hsubsim Sim.FindSubsimByName( hsim sim, string subsim_name )
  425. //
  426. // Finds the first subsim to match the given name.
  427. //
  428. prototype hsubsim Sim.FindSubsimByName( hsim sim, string subsim_name );
  429.  
  430. //
  431. // Channels
  432. //
  433.  
  434. //
  435. // AvatarAddChannel( hsim sim, string name, float init_value)
  436. //
  437. // Creates a channel called name onto the sim's avatar.
  438. //
  439. prototype Sim.AvatarAddChannel( hsim sim, string name, float init_value);
  440.  
  441.  
  442. //
  443. // AvatarRemoveChannel( hsim sim, string name )
  444. //
  445. // Remove the called name onto the sim's avatar.
  446. //
  447. prototype Sim.AvatarRemoveChannel( hsim sim, string name);
  448.  
  449. //
  450. // AvatarSetChannel( hsim sim, string name, float value)
  451. //
  452. // Set the named channel's value
  453. //
  454. prototype Sim.AvatarSetChannel( hsim sim, string name, float value);
  455.  
  456. //
  457. // float AvatarChannelValue( hsim sim, string name)
  458. //
  459. // Return the named channel's value
  460. //
  461. prototype float Sim.AvatarChannelValue( hsim sim, string name);
  462.  
  463. //
  464. // SetCollision(hsim sim, bool on)
  465. //
  466. // Turn collision on or off for a sim. Intended for cutscene use only.
  467. //
  468. prototype Sim.SetCollision( hsim sim, bool on);
  469.  
  470. //
  471. // IsCollisionOn(hsim sim)
  472. //
  473. // Determine if collision is on the given sim
  474. //
  475. prototype bool Sim.IsCollisionOn( hsim sim );
  476.  
  477. //
  478. // SetMass( hsim sim, float value )
  479. //
  480. // Sets the mass of the sim. Zero means infinite mass.
  481. //
  482. prototype Sim.SetMass( hsim sim, float value );
  483.  
  484. #endif // FLUX_LIB
  485.